import * as type from '../types'

const state = {
	userInfo: null,
	login: true
}

const actions = {
	saveUserInfo ({commit}, data) {
		commit(type.SAVE_USER_INFO, data)
	}
}

const mutations = {
	[type.SAVE_USER_INFO] (state, data) {
		state.userInfo = data
	}
}

const getters = {
	userInfo: state => {
		return state.userInfo
	},
	login: state => {
		return state.login
	}
}

export default {
	state,
	actions,
	mutations,
	getters
}